package com.jpa.yuan.mapper;

import com.jpa.yuan.vo.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.Date;
import java.util.List;

public interface Userrepo extends JpaRepository<User, Integer>, JpaSpecificationExecutor<User> {
    public User findByLastName(String name);

    @Query(value = "select * from t_user where last_name=?1", nativeQuery = true)
    public List<User> findNames(String lastName);

    @Query(value = "from t_user where lastName=?1")
    List<User> findByAgeAndAddress(String name);

    public User findByCreateTimeBefore(Date date);
}
